package com.summer_administration.mapper;

import com.summer_administration.pojo.Income;
import org.apache.ibatis.annotations.*;
import java.util.List;

@Mapper
public interface IncomeMapper {
    //新增
    @Insert("Insert into income(title, number, method, picture, date, remark, create_user, create_time, update_time)" +
            "values(#{title},#{number},#{method},#{picture},#{date},#{remark},#{createUser},#{createTime},#{updateTime}) ")
    void add(Income income);

    //分页查询
    List<Income> list(Integer userId,String method);

    //更新
    @Update("update income set title=#{title},number=#{number},method=#{method},picture=#{picture},date=#{date},remark=#{remark},update_time=#{updateTime} where id=#{id}")
    void update(Income income);


    //删除文章
    @Delete("delete from income where id=#{id}")
    void delete(Integer id);

    //根据小组名查询小组id
    @Select("SELECT group_id FROM groupe WHERE group_name = #{groupName}")
    String findGroupIdByGroupName(String groupName);
}
